#ifndef __LOG_HPP__
#define __LOG_HPP__

#include <iostream>
#include <string>
#include <sys/time.h>

#define INFO 0
#define DEBUG 1
#define WARNING 2
#define ERROR 3
uint64_t GetTimeStamp()
{
    struct timeval time;
    gettimeofday(&time, NULL);
    return time.tv_sec;
}

std::string GetLevefMessage(int levef_)
{
    switch(levef_){
        case 0:
            return "INFO";
        case 1:
            return "DEBUG";
        case 2:
            return "WARNING";
        case 3:
            return "ERROR";
        default:
            return "UNKNOW";
    }
    return "UNKNOW";
}

void LOG(int levef_, std::string message, std::string file_, int line_)
{
    std::cout<<"["<<" "<<GetTimeStamp()<<" "<<GetLevefMessage(levef_)<<"]"<<" : "<<'['<<file_<<" : "<<line_<<']'<<" "<<message<<std::endl;
}

#define LOG(levef_, message) LOG(levef_, message, __FILE__, __LINE__)
#endif
